/* This file contains replication code for Vossler, Bergeron, Doyon, and Rondeau, "Revisiting the gap between the willingness to pay and willingness to accept for public goods" published in JAERE */
/* The associated data file is "VBDR replication data.dta" */
/* If you have comments or questions, contact Christian Vossler (cvossler@utk.edu) */
/* July 2022 */

/* load data */
clear all
cd "D:\Research\Quebec WTP-WTA\Analysis\"
use "VBDR replication data.dta"

/* Table 2. Socioeconomic comparison of the survey sample with those of the Quebec population above 18 years of age */
tab SE12 // 1 = male, 2 = female
tab AGER // age categories
tab SE5R if SE5R!=0 // education categories
tab STRR // location 
tab Income

/* Table 3. Data description */
sum Vote Bid Scope Charity EnvOrg Male College Homeowner HHsize Retired Student Quebec Montreal VeryUnlikely SomewhatUnlikely Likely DateIV

/* Table 4. Scenario-specific consequentiality beliefs by welfare frame */
tab Q2X if WTA==1
tab Q2X if WTP==1
// test for equal response distributions
tab Q2X WTA, chi2 

/* Table 5. Sample means by scenario-specific consequentiality beliefs */
global summary Scope Charity EnvOrg Male College Homeowner HHsize Retired Student Quebec Montreal
sum $summary if Consequential==0
sum $summary if Consequential==1
sum $summary if Consequential==2
foreach var in $summary {
tab `var' Consequential, chi2
}

// define covariates for regression models
global controls Scope_m Charity_m EnvOrg_m Male_m College_m Homeowner_m HHsize_m Retired_m Student_m Quebec_m Montreal_m

/* Table 6. Welfare estimates (Can$), by scenario-specific consequentiality beliefs */
*Specification 1: unconditional
intreg LB UB if WTA==1, nolog
est store WTA
intreg LB UB if WTP==1, nolog
est store WTP
suest WTA WTP
// Standard deviations (as Stata reports natural log of SD)
nlcom exp([WTA_lnsigma]_cons)
nlcom exp([WTP_lnsigma]_cons)
// WTA/WTP ratio
nlcom [WTA_model]_b[_cons] / [WTP_model]_b[_cons]

*Specification 2: conditional
intreg LB UB i.Consequential if WTA==1, nolog het(SomewhatUnlikely Likely)
est store WTA
intreg LB UB i.Consequential if WTP==1, nolog het(SomewhatUnlikely Likely)
est store WTP
suest WTA WTP
// Standard deviations (as Stata reports natural log of SD)
nlcom exp([WTA_lnsigma]_cons)
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]SomewhatUnlikely) 
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]Likely) 
nlcom exp([WTP_lnsigma]_cons)
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]SomewhatUnlikely) 
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]Likely) 
// Very unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons
nlcom [WTP_model]_cons
nlcom [WTA_model]_b[_cons] / [WTP_model]_b[_cons]
// Somewhat unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]1.Consequential
nlcom [WTP_model]_cons + [WTP_model]1.Consequential
nlcom ([WTA_model]_b[_cons] + [WTA_model]_b[1.Consequential]) / ([WTP_model]_b[_cons] + [WTP_model]_b[1.Consequential])
// Somewhat/very likely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]2.Consequential
nlcom [WTP_model]_cons + [WTP_model]2.Consequential
nlcom ([WTA_model]_cons + [WTA_model]2.Consequential)/ ([WTP_model]_cons + [WTP_model]2.Consequential)

*Specification 3: control variables
intreg LB UB i.Consequential $controls if WTA==1, nolog het(SomewhatUnlikely Likely)
est store WTA
intreg LB UB i.Consequential $controls if WTP==1, nolog het(SomewhatUnlikely Likely)
est store WTP
suest WTA WTP
// Standard deviations (as Stata reports natural log of SD)
nlcom exp([WTA_lnsigma]_cons)
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]SomewhatUnlikely) 
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]Likely) 
nlcom exp([WTP_lnsigma]_cons)
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]SomewhatUnlikely) 
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]Likely) 
// Very unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons
nlcom [WTP_model]_cons
nlcom [WTA_model]_b[_cons] / [WTP_model]_b[_cons]
// Somewhat unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]1.Consequential
nlcom [WTP_model]_cons + [WTP_model]1.Consequential
nlcom ([WTA_model]_b[_cons] + [WTA_model]_b[1.Consequential]) / ([WTP_model]_b[_cons] + [WTP_model]_b[1.Consequential])
// Somewhat/very likely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]2.Consequential
nlcom [WTP_model]_cons + [WTP_model]2.Consequential
nlcom ([WTA_model]_cons + [WTA_model]2.Consequential)/ ([WTP_model]_cons + [WTP_model]2.Consequential)

*Specification 4: regression adjustment
intreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTA==1, nolog het(SomewhatUnlikely Likely)
est store WTA
intreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTP==1, nolog het(SomewhatUnlikely Likely)
est store WTP
suest WTA WTP
// Standard deviations (as Stata reports natural log of SD)
nlcom exp([WTA_lnsigma]_cons)
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]SomewhatUnlikely) 
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]Likely) 
nlcom exp([WTP_lnsigma]_cons)
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]SomewhatUnlikely) 
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]Likely) 
// Very unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons
nlcom [WTP_model]_cons
nlcom [WTA_model]_b[_cons] / [WTP_model]_b[_cons]
// Somewhat unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]1.Consequential
nlcom [WTP_model]_cons + [WTP_model]1.Consequential
nlcom ([WTA_model]_b[_cons] + [WTA_model]_b[1.Consequential]) / ([WTP_model]_b[_cons] + [WTP_model]_b[1.Consequential])
// Somewhat/very likely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]2.Consequential
nlcom [WTP_model]_cons + [WTP_model]2.Consequential
nlcom ([WTA_model]_cons + [WTA_model]2.Consequential)/ ([WTP_model]_cons + [WTP_model]2.Consequential)

*Specification 5: instrumental variables
// Note: "eintreg" only works for Stata v.17 or later
eintreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTA==1, nolog endogenous(Consequential = DateIV $controls, oprobit nomain)
est store WTA
eintreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTP==1, nolog endogenous(Consequential = DateIV $controls, oprobit nomain)
est store WTP
suest WTA WTP
// Very unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_LB]_cons
nlcom [WTP_LB]_cons
nlcom [WTA_LB]_b[_cons] / [WTP_LB]_b[_cons]
// Somewhat unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_LB]_cons + [WTA_LB]1.Consequential
nlcom [WTP_LB]_cons + [WTP_LB]1.Consequential
nlcom ([WTA_LB]_b[_cons] + [WTA_LB]_b[1.Consequential]) / ([WTP_LB]_b[_cons] + [WTP_LB]_b[1.Consequential])
// Somewhat/very likely (WTA, WTP, WTA/WTP)
nlcom [WTA_LB]_cons + [WTA_LB]2.Consequential
nlcom [WTP_LB]_cons + [WTP_LB]2.Consequential
nlcom ([WTA_LB]_cons + [WTA_LB]2.Consequential)/ ([WTP_LB]_cons + [WTP_LB]2.Consequential)


/* Robustness checks */

*Scope effect, WTP sample, for those indicating conservation target is achievable
intreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTP==1 & Attainable==1, nolog het(SomewhatUnlikely Likely) 
nlcom _b[0.Consequential#c.Scope_m]
nlcom _b[1.Consequential#c.Scope_m]
nlcom _b[2.Consequential#c.Scope_m]

*Exclude low-income households from WTP sample
intreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTA==1, nolog het(SomewhatUnlikely Likely)
est store WTA
intreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTP==1 & LowIncome!=1, nolog het(SomewhatUnlikely Likely)
est store WTP
suest WTA WTP
// Standard deviations (as Stata reports natural log of SD)
nlcom exp([WTA_lnsigma]_cons)
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]SomewhatUnlikely) 
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]Likely) 
nlcom exp([WTP_lnsigma]_cons)
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]SomewhatUnlikely) 
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]Likely) 
// Very unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons
nlcom [WTP_model]_cons
nlcom [WTA_model]_b[_cons] / [WTP_model]_b[_cons]
// Somewhat unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]1.Consequential
nlcom [WTP_model]_cons + [WTP_model]1.Consequential
nlcom ([WTA_model]_b[_cons] + [WTA_model]_b[1.Consequential]) / ([WTP_model]_b[_cons] + [WTP_model]_b[1.Consequential])
// Somewhat/very likely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]2.Consequential
nlcom [WTP_model]_cons + [WTP_model]2.Consequential
nlcom ([WTA_model]_cons + [WTA_model]2.Consequential)/ ([WTP_model]_cons + [WTP_model]2.Consequential)

*Drop high WTA amounts and low WTP bids from estimation samples (so only bids/offers in common are used) 
intreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTA==1 & Bid!=1500 & Bid!=1000, nolog het(SomewhatUnlikely Likely) technique(bfgs) 
est store WTA
intreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTP==1 & Bid!=10 & Bid!=50, nolog het(SomewhatUnlikely Likely)
est store WTP
suest WTA WTP
// Standard deviations (as Stata reports natural log of SD)
nlcom exp([WTA_lnsigma]_cons)
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]SomewhatUnlikely) 
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]Likely) 
nlcom exp([WTP_lnsigma]_cons)
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]SomewhatUnlikely) 
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]Likely) 
// Very unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons
nlcom [WTP_model]_cons
nlcom [WTA_model]_b[_cons] / [WTP_model]_b[_cons]
// Somewhat unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]1.Consequential
nlcom [WTP_model]_cons + [WTP_model]1.Consequential
nlcom ([WTA_model]_b[_cons] + [WTA_model]_b[1.Consequential]) / ([WTP_model]_b[_cons] + [WTP_model]_b[1.Consequential])
// Somewhat/very likely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]2.Consequential
nlcom [WTP_model]_cons + [WTP_model]2.Consequential
nlcom ([WTA_model]_cons + [WTA_model]2.Consequential)/ ([WTP_model]_cons + [WTP_model]2.Consequential)

*Exclude respondents who did not perceive the conservation target to be achievable.
intreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTA==1 & Attainable==1, nolog het(SomewhatUnlikely Likely) difficult
est store WTA
intreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTP==1 & Attainable==1, nolog het(SomewhatUnlikely Likely)
est store WTP
suest WTA WTP
// Standard deviations (as Stata reports natural log of SD)
nlcom exp([WTA_lnsigma]_cons)
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]SomewhatUnlikely) 
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]Likely) 
nlcom exp([WTP_lnsigma]_cons)
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]SomewhatUnlikely) 
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]Likely) 
// Very unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons
nlcom [WTP_model]_cons
nlcom [WTA_model]_b[_cons] / [WTP_model]_b[_cons]
// Somewhat unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]1.Consequential
nlcom [WTP_model]_cons + [WTP_model]1.Consequential
nlcom ([WTA_model]_b[_cons] + [WTA_model]_b[1.Consequential]) / ([WTP_model]_b[_cons] + [WTP_model]_b[1.Consequential])
// Somewhat/very likely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]2.Consequential
nlcom [WTP_model]_cons + [WTP_model]2.Consequential
nlcom ([WTA_model]_cons + [WTA_model]2.Consequential)/ ([WTP_model]_cons + [WTP_model]2.Consequential)

*Include all FOUR consequentiality belief categories.
// Note: this relies on specification 3 due to degrees of freedom issues.
intreg LB UB $controls i.Consequential2 if WTA==1, nolog het(WeaklyC2 ModeratelyC2 StronglyC2)
est store WTA
intreg LB UB $controls i.Consequential2 if WTP==1, nolog het(WeaklyC2 ModeratelyC2 StronglyC2) 
est store WTP
suest WTA WTP
// Standard deviations (as Stata reports natural log of SD)
nlcom exp([WTA_lnsigma]_cons)
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]WeaklyC2) 
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]ModeratelyC2) 
nlcom exp([WTA_lnsigma]_cons + [WTA_lnsigma]StronglyC2) 
nlcom exp([WTP_lnsigma]_cons)
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]WeaklyC2) 
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]ModeratelyC2) 
nlcom exp([WTP_lnsigma]_cons + [WTP_lnsigma]StronglyC2) 
// Very unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons
nlcom [WTP_model]_cons
nlcom [WTA_model]_b[_cons] / [WTP_model]_b[_cons]
// Somewhat unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]1.Consequential
nlcom [WTP_model]_cons + [WTP_model]1.Consequential
nlcom ([WTA_model]_b[_cons] + [WTA_model]_b[1.Consequential]) / ([WTP_model]_b[_cons] + [WTP_model]_b[1.Consequential])
// Somewhat likely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]2.Consequential
nlcom [WTP_model]_cons + [WTP_model]2.Consequential
nlcom ([WTA_model]_cons + [WTA_model]2.Consequential)/ ([WTP_model]_cons + [WTP_model]2.Consequential)
// Very likely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]3.Consequential
nlcom [WTP_model]_cons + [WTP_model]3.Consequential
nlcom ([WTA_model]_cons + [WTA_model]3.Consequential)/ ([WTP_model]_cons + [WTP_model]3.Consequential)

*Remove $0 LB on WTP
intreg LB UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTA==1, nolog het(SomewhatUnlikely Likely)
est store WTA
intreg LB2 UB ibn.Consequential#c.($controls) 1.Consequential 2.Consequential if WTP==1, nolog
// note: restricted to homogeneous error variances due to convergence issues
est store WTP
suest WTA WTP
// Very unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons
nlcom [WTP_model]_cons
nlcom [WTA_model]_b[_cons] / [WTP_model]_b[_cons]
// Somewhat unlikely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]1.Consequential
nlcom [WTP_model]_cons + [WTP_model]1.Consequential
nlcom ([WTA_model]_b[_cons] + [WTA_model]_b[1.Consequential]) / ([WTP_model]_b[_cons] + [WTP_model]_b[1.Consequential])
// Somewhat/very likely (WTA, WTP, WTA/WTP)
nlcom [WTA_model]_cons + [WTA_model]2.Consequential
nlcom [WTP_model]_cons + [WTP_model]2.Consequential
nlcom ([WTA_model]_cons + [WTA_model]2.Consequential)/ ([WTP_model]_cons + [WTP_model]2.Consequential)

/* Table A6. Tests for differences in covariate means across "somewhat/very likely" and combined "very unlikely" and "somewhat unlikely" subsamples: WTA */
sum $summary if Likely==1 & WTA==1
sum $summary if Likely==0 & WTA==1
foreach var in $summary {
tab `var' Likely if WTA==1, chi2
}

/* Table A7. Tests for differences in covariate means across "somewhat/very likely" and combined "very unlikely" and "somewhat unlikely" subsamples: WTP */
sum $summary if Likely==1 & WTP==1
sum $summary if Likely==0 & WTP==1
foreach var in $summary {
tab `var' Likely if WTP==1, chi2
}

/* Table A8. Tests for differences in covariate means across "somewhat/very likely" WTA and WTP subsamples */
sum $summary if Likely==1 & WTA==1
sum $summary if Likely==1 & WTP==1
foreach var in $summary {
tab `var' WTP if Likely==1, chi2
}
